import { PromiseData } from '@/@types/request'
import request from '@/utils/request'
import { TableInfo } from './data'

interface Params {
  platformId?: number
  provinceId?: number // 省id
  cityId?: number // 城市id
}
// 获取医院定级统计数据
export const getByLevel = (data: Params) => request.post('/hospitalCount/countByLevel', data)

// 获取定等医院数据

export const getByRate = (data: Params) => request.post('/hospitalCount/countByRate', data)

// 根据平台id进行医院类型统计
export const getByType = (data: Params) => request.post('/hospitalCount/countByType', data)

// 请求地图数据
export const getMapData = (
  data: Params,
): Promise<
  PromiseData<{
    geoJson: string
    id: number
    platformId: number
  }>
> => request.post('/hospitalCount/geoData', data)

// 请求用户数
export const getUserData = (
  data: Params,
): Promise<
  PromiseData<{
    cityDataList: {
      cityId: number
      cityName: string
      hospitalTotalCountByCity: string
    }[]
    hospitalTotalCount: number
  }>
> => request.post('/hospitalCount/countByCity', data)

// 加载表格数据
export const getTableList = (data: { year: string; quarter: string }): Promise<PromiseData<TableInfo[]>> =>
  request.post('/hospitalCount/countInjuryInfo', data)
